from django.conf.urls import url, include
from django.contrib import admin
from web.views import account, home
from web.templates import *
from web.views import project
from web.views import statistics
from web.views import wiki
from web.views import file
from web.views import setting
from web.views import issues
from web.views import dashboard
urlpatterns = [
    # 临时加的 配合vue前端
    # url(r'^loaded/$', account.loaded, name='loaded'),

    url(r'^register/$', account.register, name='register'),
    url(r'^send_sms/$', account.send_sms, name='send_sms'),
    url(r'^login_sms/$', account.login_sms, name='login_sms'),
    url(r'^login/$', account.login, name='login'),
    url(r'^image/code/$', account.image_code, name='image_code'),
    url(r'^index/$', home.index, name='index'),
    url(r'^logout/$', account.logout, name='logout'),
    # 价格
    url(r'^price/$', account.price, name='price'),
    url(r'^payment/(?P<vip_id>\d+)/$', account.payment, name='payment'),
    url(r'^pay/$', account.pay, name='pay'),
    url(r'^pay/notify/$', account.pay_notify, name='pay_notify'),
    # 项目列表
    url(r'^project/list/$', project.project_list, name='project_list'),
    url(r'^project/star/(?P<project_type>\w+)/(?P<project_id>\d+)/$',
        project.project_star, name='project_star'),
    # url(r'^project/star/?project_type=\w+&project_id=\d+$', project.project_star, name='project_star'),
    url(r'^project/unstar/(?P<project_type>\w+)/(?P<project_id>\d+)/$',
        project.project_unstar, name='project_unstar'),

    # 项目的管理
    url(r'^manage/(?P<project_id>\d+)/', include([
        # 概览
        url(r'^dashboard/$', dashboard.dashboard, name='dashboard'),
        url(r'^dashboard/issues/chart/$', dashboard.issues_chart, name='issues_chart'),




        # 文档操作
        url(r'^wiki/$', wiki.wiki, name='wiki'),
        url(r'^wiki/add/$', wiki.wiki_add, name='wiki_add'),
        url(r'^wiki/delete/(?P<wiki_id>\d)/$', wiki.wiki_delete, name='wiki_delete'),
        url(r'^wiki/edit/(?P<wiki_id>\d)/$', wiki.wiki_edit, name='wiki_edit'),
        url(r'^wiki/upload/$', wiki.wiki_upload, name='wiki_upload'),
        url(r'^wiki/catalog/$', wiki.wiki_catalog, name='wiki_catalog'),
        # 文件夹操作
        url(r'^file/$', file.file, name='file'),
        url(r'^file/delete/$', file.file_delete, name='file_delete'),
        url(r'^file/cos_credentials/$', file.cos_credentials, name='cos_credentials'),
        url(r'^file/post/$', file.file_post, name='file_post'),
        url(r'^file/download/(?P<file_id>\d+)/$', file.file_download, name='file_download'),
        # 配置
        url(r'^setting/$', setting.setting, name='setting'),
        url(r'^setting/delete/$', setting.delete_setting, name='delete_setting'),
        # 问题
        url(r'^issues/$', issues.issues, name='issues'),
        url(r'^issues/detail/(?P<issues_id>\d+)/$', issues.issues_detail, name='issues_detail'),
        url(r'^issues/record/(?P<issues_id>\d+)/$', issues.issues_record, name='issues_record'),
        url(r'^issues/upload/(?P<issues_id>\d+)/$', issues.issues_update, name='issues_update'),
        # 统计
        url(r'^statistics/$', statistics.statistics, name='statistics'),
        url(r'^statistics/pie/$', statistics.statistics_pie, name='statistics_pie'),
        url(r'^statistics/column/$', statistics.statistics_column, name='statistics_column')
        ], None, None)),


]
# 项目的管理
"""
url(r'^manage/(?P<project_id>\d+)/dashboard/$', project.project_unstar,
    name='project_unstar'),
url(r'^manage/(?P<project_id>\d+)/issues/$', project.project_unstar,
    name='project_unstar'),
url(r'^manage/(?P<project_id>\d+)/statistics/$', project.project_unstar,
    name='project_unstar'),
url(r'^manage/(?P<project_id>\d+)/file/$', project.project_unstar,
    name='project_unstar'),
url(r'^manage/(?P<project_id>\d+)/wiki/$', project.project_unstar,
    name='project_unstar'),
url(r'^manage/(?P<project_id>\d+)/setting/$', project.project_unstar,
    name='project_unstar'),
"""